from Crypto.Util.number import *
from Crypto.Util.Padding import pad
from random import *


s1=[9, 31, 32, 38, 20, 1, 22, 4, 8, 2, 11, 21, 7, 18, 46, 23, 34, 3, 19, 12, 45, 30, 27, 37, 5, 47, 28, 36, 0, 43, 39, 10, 29, 14, 40, 24, 33, 16, 17, 6, 42, 15, 26, 41, 44, 25, 35, 13]
c=[99, 111, 102, 11, 107, 49, 11, 53, 121, 48, 114, 117, 11, 95, 112, 95, 109, 115, 11, 95, 101, 95, 119, 117, 79, 123, 111, 48, 110, 95, 121, 116, 121, 125, 116, 11, 119, 11, 97, 67, 11, 11, 11, 11, 11, 99, 110, 104]


def s_box(a):
    box=[i for i in range(a)]
    shuffle(box)
    return box

def encrypt2(m):
    for i in range(16):
        m=[m[i] for i in s1]
    return m


a="ctfshow{"
a1=[ord(i) for i in a]
print(a1)
print(c[:8])
while 1:
    c=encrypt2(c)
    if c[:8]==a1:
        print(c)
        break
flag=""
for i in c:
    try:
        flag+=chr(i)
    except:
        continue
print(flag)